use axum::{
    routing::{ get, post, put },
    Router
};
mod master;
mod structure;
mod controls;

pub fn routes() -> Router{
    Router::new()
    .route("/table", get(master::list))
    .route("/table_list", get(master::list_all))
    .route("/table_dict", get(master::dict))
    .route("/col",get(master::col))
    
    .route("/show_columns",get(master::show_columns))
    .route("/show_key",get(master::show_key))
    .route("/find_key_name",get(master::find_key_name))
    .route("/find_primary_key",get(master::find_primary_key))
    .route("/show_foreign_key",get(master::show_foreign_key))
    .route("/show_foreign_keys",get(master::show_foreign_keys))
    .route("/show_information_schema_table",get(master::show_information_schema_table))
    .route("/show_create_table_sql",get(master::show_create_table_sql))
    .route("/table_data",get(master::table_data))
    .route("/table_data/add",post(controls::add_table_data))
    .route("/table_data/update",put(controls::update_table_data))
    .route("/table_data/find",get(master::table_data_find))
    .route("/table_data/del",put(controls::del_table_data))
    
    .route("/table/del",post(controls::del))
    .route("/backups_csv",get(controls::backups_csv))
    .route("/backups_excel",get(controls::backups_excel))
    .route("/intofile",post(controls::intofile))
    .route("/sort_id",put(controls::sort_id))
    .route("/create_table",post(controls::create_table))
    .route("/create_migration",post(controls::create_migration))
    .route("/mod_table_name",post(controls::mod_table_name))
    .route("/mod_table_comment",post(controls::mod_table_comment))
    
    .route("/truncate_table",put(controls::truncate_table))
    .route("/delete_table",put(controls::delete_table))

    .route("/structure",get(master::table_structure))
    .route("/structure/save_field",post(structure::save_field).put(structure::save_field))
    .route("/structure/del_field",put(structure::del_field))
    .route("/structure/mod_field_name",put(structure::mod_field_name))
    .route("/structure/mod_type",put(structure::mod_type))
    .route("/structure/mod_null",put(structure::mod_null))
    .route("/structure/mod_default",put(structure::mod_default))
    .route("/structure/mod_extra",put(structure::mod_extra))
    .route("/structure/mod_comment",put(structure::mod_comment))
    .route("/structure/mod_site",put(structure::mod_site))
    .route("/structure/mod_key",put(structure::mod_key))
    .route("/structure/add_key",put(structure::add_key))
    .route("/structure/del_key",put(structure::del_key))
    .route("/structure/add_foreign_key",put(structure::add_foreign_key))
    .route("/structure/del_foreign_key",put(structure::del_foreign_key))
    .route("/structure/set_auto_increment",put(structure::set_auto_increment))
    .route("/structure/mod_field",put(structure::mod_field))
}
